package com.sloera.spring.beans.factory;

import java.util.HashMap;
import java.util.Map;

/**
 * 实例工厂方法：实例工厂的方法，即先创建工厂本身，再调用工厂的实例方法来返回 bean 的实例
 *
 * @author sloera
 * @create 2020/4/6
 */
public class InstanceCarFactory {
    private Map<String, Car> carMap = null;

    public InstanceCarFactory() {
        carMap = new HashMap<>();
        carMap.put("audi", new Car("audi", 30000));
        carMap.put("ford", new Car("ford", 40000));
    }

    public Car getCar(String band) {
        return carMap.get(band);
    }
}
